package extrator.hmm;

import util.FileOp;
import java.util.*;

public class HMM {
	private int M;
	private int N;
	private double[][] A;
	private double[][] B;
	private double[] p;
	
	public void setParaFromFile(String filePath) {
		String content = FileOp.getContent(filePath);
		String[] items = content.split("\r\n");
		
		M = Integer.parseInt(items[0].substring(2));
		N = Integer.parseInt(items[1].substring(2));
		A = new double[N][N];
		B = new double[N][M];
		p = new double[N];
		for(int i = 0; i < N; i++) {
			String[] numStr = items[i+3].split(" ");
			for(int j = 0; j < N; j++) {
				A[i][j] = Double.parseDouble(numStr[j]);
			}
		}
		
		for(int i = 0; i < N; i++) {
			String[] numStr = items[i+4+N].split(" ");
			for(int j = 0; j < M; j++) {
				B[i][j] = Double.parseDouble(numStr[j]);
			}
		}
		
		String[] numStr = items[5+N+N].split(" ");
		for(int i = 0; i < N; i++) {
			p[i] = Double.parseDouble(numStr[i]);
		}
	}
	
	public int getM() {
		return M;
	}
	
	public int getN() {
		return N;
	}
	
	public double[][] getA() {
		return A;
	}
	
	public double[][] getB() {
		return B;
	}
	
	public double[] getP() {
		return p;
	}

}

